﻿// DlgAdjustingCoordinates.cpp: 实现文件
//

#include "stdafx.h"
#include "GHCY.h"
#include "DlgPassword.h"
#include "DlgAdjustingCoordinates.h"
#include "afxdialogex.h"


// DlgAdjustingCoordinates 对话框

IMPLEMENT_DYNAMIC(DlgAdjustingCoordinates, CDialogEx)

DlgAdjustingCoordinates::DlgAdjustingCoordinates(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_ADJUSTINGCOORDINATES, pParent)
	, m_fX(theApp.m_fAdjustingCoordinatesX)
	, m_fY(theApp.m_fAdjustingCoordinatesY)
	, m_fAngle(theApp.m_fAdjustingCoordinatesA)
{

}

DlgAdjustingCoordinates::~DlgAdjustingCoordinates()
{
}

void DlgAdjustingCoordinates::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_fX);
	DDX_Text(pDX, IDC_EDIT2, m_fY);
	DDX_Text(pDX, IDC_EDIT3, m_fAngle);
}


BEGIN_MESSAGE_MAP(DlgAdjustingCoordinates, CDialogEx)
	ON_BN_CLICKED(IDOK, &DlgAdjustingCoordinates::OnBnClickedOk)
END_MESSAGE_MAP()


// DlgAdjustingCoordinates 消息处理程序


void DlgAdjustingCoordinates::OnBnClickedOk()
{
	UpdateData();

	theApp.m_fAdjustingCoordinatesX = m_fX;
	theApp.m_fAdjustingCoordinatesY = m_fY;
	theApp.m_fAdjustingCoordinatesA = m_fAngle;

	theApp.setSysFloat(L"m_fAdjustingCoordinatesX", m_fX);
	theApp.setSysFloat(L"m_fAdjustingCoordinatesY", m_fY);
	theApp.setSysFloat(L"m_fAdjustingCoordinatesA", m_fAngle);

	CDialogEx::EndDialog(IDOK);

	AfxMessageBox(L"坐标设置完成，重启软件生效。");
}


BOOL DlgAdjustingCoordinates::OnInitDialog()
{
#ifndef _DEBUG
	DlgPassword pw;
	pw.DoModal();
	if (pw.m_strPassword != L"82669566")
	{
		EndDialog(IDCANCEL);
		return FALSE;
	}
#endif

	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化

	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}
